<!--
  - Copyright (C) 2024
  - All rights reserved, Designed By www.joolun.com
  - 注意：
  - 本软件为www.joolun.com开发研制，未经购买不得使用
  - 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
  - 一经发现盗用、分享等行为，将追究法律责任，后果自负
-->
<!-- 聊天消息类型 -->
<!-- 默认(通用)类型 可显示 订单消息/商品信息消息-->
<template>
	<view @click="goPage">
		<view class="cu-avatar image-bg bg-white" :style="{ 'background-image': msgBody.imgUrl ? 'url(' + msgBody.imgUrl + ')' : '' }"></view>
		<view class="text-sm padding-left-xs">
			<view class="text-lg margin-top-sm overflow-2">{{ msgBody.name }}</view>
			<text class="cu-tag df radius bg-red margin-top-sm">{{ msgBody.type }}</text>
			<view class="text-red text-xl text-bold margin-top-sm padding-bottom-sm">{{ msgBody.desc }}</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		msgBody: {
			//消息体
			type: Object,
			default: {}
		}
	},
	data() {
		return {};
	},
	methods: {
		goPage() {
			if (this.msgBody.type == '商品') {
				uni.navigateTo({
					url: '/pages/mall/goodsspu/detail?id=' + this.msgBody.id
				});
			} else if (this.msgBody.type == '订单') {
				uni.navigateTo({
					url: '/pages/mall/order/detail?id=' + this.msgBody.id
				});
			}
		}
	}
};
</script>

<style>
.image-bg {
	width: 390rpx;
	height: 390rpx;
}
</style>
